10/23/2021

Index.

1.- Executive Summary.

2.- Regression AAPL vs S&P500.

3.- AAPL Close vs SP500 & NASDAQ100.

4.- Months, days and trading sessions.

5.- Regression AAPLre vs SP500re.

6.- Betas daily rolling 3,5,7,10 years.

7.- Beta summary.

8.- Look ahead: Building a Forecast model.

Index (Contd…)

9.- Model Structure.

10.-Regression Model: dataset.

11.-Time-related predictors.

12.-Market-related predictors.

13.-Discount rates -related predictors.

14.-Model Output: ANOVA.

15.-Model Output: Coefficients.

16.-But there is a concern: multicolinearity.

Index (Contd…)

17.-Predictors correlations.

18.-Residuals Plot.

19.-Root Mean Squared Error (RMSE).

20.-Apple Close (Forecast).

21.-Risk: Probability of permanent loss.

22.-Risk goes down with longer hold.

Executive Summary.

This presentation summarizes the work done to find a model to represent and predict Apple’s share price (ticker AAPL) at the closing of every session, and forecast future prices a number of sessions forward ( in this case 21 sessions, about a month of trading).

The data set covers trading sessions since January 1990 until October 2021. The model is built for the dataset to update itself (through R code reaching out to the Yahoo platform), predict and update the model with new data, and forecast 21 sessions forward.

The last update for the purpose of this document was performed on October 21, 2021.

Executive Summary (Contd….)

The closing of AAPL is represented by a linear regression model which includes predictors such us sequential days of trading, year, month, day, the closing level of the S&P500 and the NASDAQ100, 5 year, 10 year, and 30 year Treasury prices, and the dollar index.

The relationship between the predictors and the AAPL shares is not always linear. The predictors are hence transformed to reflect this, and then lagged 21 periods (trading sessions) to forecast forward closings.

There are signs of colinearity (predictors highly correlated with each other) in the model. This needs further research, certainly constitutes an opportunity for improvement, and is beyond the scope of this work for the time being.

Executive Summary (Contd….)

The model predicts AAPL closing with an error of 1.40 usd/share on the training set and 10.34 usd/share on the testing set. A total of 87% of the actual data points on the testing set are within 1 standard error of 10.34 usd/share.

Apple’s closing on October 21 was 149.48 usd/share (Yahoo Finance). The model predicts 151.89 usd/share for that day.

The model forecasts AAPL to close on October 22, 2021 (next trading session) at 156.19 usd/share. AAPL actually closed at 148.69 (Yahoo Finance).

The forecast for 25 October was 156.36 usd/share, AAPL closed at 148.64 (Yahoo Finance).

Executive Summary (Contd….)

All this may be explored on the graphs. Beta coefficients versus the S&P500 are also derived and explored. The 5 years rolling Beta to the S&P500 reported by the model is 1.21 (verus 1.23 reported by Yahoo Finance). Beta is often interpreted as a measure of volatility and risk. The evolution of Beta for 3,5,7, and 10 years may be explore interactively on the graphs.

This work also suggest a different approach to see and measure risk. I suggest that risk be understood as the probability of permanent loss. That requires a buy-hold-sell strategy within a window of time. The time window goes from 1,5,10,20,50,100,200(approx 1 Year),400,1000,2000(10 Years),4000 trading sessions. The wider the time window, the lower the probability of permanent loss –the lower the risk–.

Regression AAPL vs S&P500.

lm(formula = AAPLClose ~ (. - date - Month - X.TYXClose - DX.Y.NYBClose - 
    X.DJIClose) + factor(Month, exclude = c(5, 11, 4, 12, 6, 
    7, 3, 2)), data = FullDF)
[1] "Residuals:"
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
-22.8786  -2.1529  -0.2152   0.0000   3.3252  14.5205 
[1] "Adjusted R squared:"
[1] 0.9746672
Adjusted R squred at  0.97  means that the model explains
 97.47  percent of the total variance.

Regression AAPL vs S&P500. (Contd…)

[1] "F-statistic:"
   value    numdf    dendf 
10442.96    10.00  2704.00 
[1] "P-value:"
value 
    0 
High F-statictic and low (zero) p-values means that the model is significant.
 Perhaps colinearity is present.

Regression AAPL vs S&P500. (Contd…)

                 Estimate   Std. Error    t value      Pr(>|t|)
(Intercept) -7.559765e+05 2.777576e+04 -27.217129 2.244391e-144
id          -1.510236e+00 5.549118e-02 -27.215785 2.309875e-144
Year         3.799028e+02 1.395800e+01  27.217575 2.223078e-144
Day          1.050600e+00 4.034714e-02  26.039021 1.442891e-133
SP500       -2.338573e-02 9.150650e-04 -25.556364 3.200437e-129
NDXClose     1.572176e-02 1.923123e-04  81.751207  0.000000e+00
X.TNXClose  -2.670087e+00 2.112474e-01 -12.639619  1.272616e-35
X.IRXClose  -1.289807e-01 1.159453e-01  -1.112427  2.660533e-01
Month8       2.226430e+02 8.163735e+00  27.272197 6.905232e-145
Month9       2.542560e+02 9.334650e+00  27.237871 1.439944e-144
Month10      2.865822e+02 1.051457e+01  27.255718 9.827244e-145
P-values are all close to zero. This means the coefficient for the 
 predictors are significant; perhaps colinearity is present. 

Regression AAPL vs S&P500. (Contd…)

Analysis of Variance Table

Response: AAPLClose
             Df  Sum Sq Mean Sq   F value    Pr(>F)    
id            1 1328284 1328284 53545.136 < 2.2e-16 ***
Year          1     507     507    20.458 6.358e-06 ***
Day           1     146     146     5.883   0.01535 *  
SP500         1  939189  939189 37860.123 < 2.2e-16 ***
NDXClose      1  299840  299840 12086.987 < 2.2e-16 ***
X.TNXClose    1    2292    2292    92.391 < 2.2e-16 ***
X.IRXClose    1    1844    1844    74.339 < 2.2e-16 ***
Month(f)      3   18464    6155   248.105 < 2.2e-16 ***
Residuals  2704   67078      25                        
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

AAPL Close vs SP500 & NASDAQ100.

AAPL Close vs SP500 & NASDAQ100 (y secondary) ( secondary y axis does not display properly in ggplotly. Multiply main y axis by 100 to read SP500 and Nasdaq100.)